package com.panopset.game;

import com.panopset.game.blackjack.BlackjackConfig;



/**
 * Grid animation calculator.
 *
 * Represents a rectangular image with a set of like sub-images.
 *
 * @author Karl Dinwiddie
 *
 */
public class Anibreaker {

    public final int mapw;
    public final int maph;
    private final Integer h;
    private final Integer ht;
    private final Integer w;
    private final Integer wt;
    public Anibreaker(
            final BlackjackConfig config,
            final int mapWidth,
            final int mapHeight,
            final int gridWidth,
            final int gridHeight) {
        this.mapw = mapWidth;
        this.maph = mapHeight;
        this.w = mapw / gridWidth;
        this.h = maph / gridHeight;
        int deltaMultiplier = config.getScreenSizer().getMultiplier() - 1;
        this.wt = this.w + ((int) ((this.w * .5) * deltaMultiplier));
        this.ht = (wt * this.h) / this.w;
    }

    public int getDspHeight() {
        return ht;
    }
    public int getDspWidth() {
        return wt;
    }
    public int[] getPaintDimensions(final int gridx, final int gridy, final int x, final int y) {
        int sx1 = gridx * w;
        int sy1 = gridy * h;
        return new int[] {x, y, x + wt, y + ht, sx1, sy1, sx1 + w, sy1 + h };
    }
}
